1 /***
2 * Copyright 2003, 2004, 2005. CodeStreet LLC.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */
14
15 package com.codestreet.selector.parser;
16
17 import java.util.Map;
18
19 /***
20 * Class to represent the <tt>null</tt> operator. This operator checks whether
21 * the value of an identifier is <tt>null</tt>. Immutable.
22 *
23 * @author Jawaids Hakim.
24 */
25 class OpNULL implements IExpression
26 {
27 /***
28 * Ctor.
29 *
30 * @param id
31 * Identifer.
32 */
33 public OpNULL(final IExpression id)
34 {
35 id_ = id;
36 }
37
38 public Object eval(final Map identifiers)
39 {
40 return (id_.eval(identifiers) == null) ? Result.RESULT_TRUE
41 : Result.RESULT_FALSE;
42 }
43
44 public Object eval(final IValueProvider provider, final Object corr)
45 {
46 return (id_.eval(provider, corr) == null) ? Result.RESULT_TRUE
47 : Result.RESULT_FALSE;
48 }
49
50 public String toString()
51 {
52 return id_.toString() + " IS NULL";
53 }
54
55 private final IExpression id_;
56 }
This page was automatically generated by Maven